package org.example.bookingsystem.config;

import org.example.bookingsystem.common.Constants;
import org.example.bookingsystem.model.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ResponseBody
@ControllerAdvice
public class ErrorAdvice {
    @ExceptionHandler
    public Result errorHandler(Exception e){
//        e.printStackTrace();
        Result result = new Result();
        result.setCode(Constants.RESULT_FAIL);
        result.setErrorMsg("内部发生错误,请联系管理员");
        return result;
    }
}


